package com.pz.cloud.framework.base.service;

import com.baomidou.mybatisplus.annotation.TableName;
import org.jeecg.common.util.BeanConvertUtil;

import javax.persistence.Table;

public interface TableInterface {

    default  String getTableName(){
        Table table = this.getClass().getAnnotation(Table.class);
        if(table!=null){
            return table.name();
        }else{
            TableName tableName =  this.getClass().getAnnotation(TableName.class);
            if(tableName!=null){
                return tableName.value();
            }else{
                return BeanConvertUtil.camelToUnderline(this.getClass().getSimpleName());
            }
        }
    }

}
